<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
    <script type='text/javascript' src='../js/vue.js'></script>
    <script type='text/javascript' src=''></script>

</head>

<body>
    <!-- 
        生命周期函数不可修改；
        生命周期函数this指向vm或组件实例对象
     -->
    <div id="root">
        <h2 :style="{opacity}">hello SONG</h2>
    </div>
    <script>
        Vue.config.productionTip = false;

        new Vue({
            el: '#root',
            data: {
                opacity: 1

            },
            mounted() {
                setInterval(() => {
                    this.opacity -= 0.01
                    if (this.opacity <= 0) this.opacity = 1
                }, 16)

            }
        })
    </script>
</body>

</html>